package edu.zju.gis.dldsj.service.impl;

import edu.zju.gis.dldsj.dao.FunctionMapper;
import edu.zju.gis.dldsj.entity.Function;
import edu.zju.gis.dldsj.service.FunctionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yanlo yanlong_lee@qq.com
 * @version 1.0 2018/08/09
 */
@Service
public class FunctionServiceImpl implements FunctionService {
    @Autowired
    private FunctionMapper functionMapper;

    @Override
    public Function select(String pk) {
        return functionMapper.selectByPrimaryKey(pk);
    }

    @Override
    public int insert(Function function) {
        return functionMapper.insertSelective(function);
    }

    @Override
    public void update(Function function) {
        functionMapper.updateByPrimaryKeySelective(function);
    }

    @Override
    public void delete(String s) {
        functionMapper.deleteByPrimaryKey(s);
    }

    @Override
    public boolean isExist(String s) {
        return functionMapper.selectByPrimaryKey(s) != null;
    }

    @Override
    public List<Function> getByPage(int offset, int size) {
        return functionMapper.selectByPage(offset, size);
    }
}
